home *** CD-ROM | disk | FTP | other *** search
/ Almathera Ten Pack 3: CDPD 3 / Almathera Ten on Ten - Disc 3: CDPD3.iso / ab20 / unarced / graphics / pbmplus / pnm / libpnm.man < prev    next >
Text File  |  1995-03-17  |  6KB  |  199 lines

  1.  
  2.  
  3.  
  4.      libpnm(3)                     AMIGA                     libpnm(3)
  5.  
  6.  
  7.  
  8.      NAME
  9.           libpnm - functions to support portable anymap programs
  10.  
  11.      SYNOPSIS
  12.           #include <pnm.h>
  13.           cc ... libpnm.a libppm.a libpgm.a libpbm.a
  14.  
  15.  
  16.      DESCRIPTION
  17.         TYPES AND CONSTANTS
  18.           typedef ... xel;
  19.           typedef ... xelval;
  20.           #define PNM_MAXMAXVAL ...
  21.           extern xelval pnm_pbmmaxval;
  22.  
  23.           Each xel contains three xelvals, each of which should
  24.           contain only the values between 0 and PNM_MAXMAXVAL.
  25.           pnm_pbmmaxval is the maxval used when a PNM program reads a
  26.           PBM file.  Normally it is 1; however, for some programs, a
  27.           larger value gives better results.
  28.  
  29.         XEL MANIPULATIONS
  30.           xelval PNM_GET1( xel x )
  31.  
  32.           This macro extracts a single value from an xel, when you
  33.           know it's from a PBM or PGM file.  When it's from a PPM
  34.           file, use PPM_GETR(), PPM_GETG(), and PPM_GETB().
  35.  
  36.           void PNM_ASSIGN1( xel x, xelval v )
  37.  
  38.           This macro assigns a single value to an xel, when you know
  39.           it's from a PBM or PGM file.  When it's from a PPM file, use
  40.           PPM_ASSIGN().
  41.  
  42.           int PNM_EQUAL( xel x, xel y )
  43.  
  44.           This macro checks two xels for equality.
  45.  
  46.           int PNM_FORMAT_TYPE( int format )
  47.  
  48.           For distinguishing different file types.
  49.  
  50.         INITIALIZATION
  51.           void pnm_init( int* argcP, char* argv[] )
  52.  
  53.           All PNM programs must call this routine.
  54.  
  55.         MEMORY MANAGEMENT
  56.           xel** pnm_allocarray( int cols, int rows )
  57.  
  58.           Allocate an array of xels.
  59.  
  60.  
  61.  
  62.  
  63.      Page 1                                         (printed 10/19/91)
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70.      libpnm(3)                     AMIGA                     libpnm(3)
  71.  
  72.  
  73.  
  74.           xel* pnm_allocrow( int cols )
  75.  
  76.           Allocate a row of the given number of xels.
  77.  
  78.           void pnm_freearray( xel** xels, int rows )
  79.  
  80.           Free the array allocated with pnm_allocarray() containing
  81.           the given number of rows.
  82.  
  83.           void pnm_freerow( xel* xelrow )
  84.  
  85.           Free a row of xels.
  86.  
  87.         READING FILES
  88.           void pnm_readpnminit( FILE* fp, int* colsP, int* rowsP, xelval* maxvalP, int* formatP )
  89.  
  90.           Read the header from a PNM file, filling in the rows, cols,
  91.           maxval and format variables.
  92.  
  93.           void pnm_readpnmrow( FILE* fp, xel* xelrow, int cols, xelval maxval, int format )
  94.  
  95.           Read a row of xels into the xelrow array.  Format, cols, and
  96.           maxval were filled in by pnm_readpnminit().
  97.  
  98.           xel** pnm_readpnm( FILE* fp, int* colsP, int* rowsP, xelval* maxvalP, int* formatP )
  99.  
  100.           Read an entire anymap file into memory, returning the
  101.           allocated array and filling in the rows, cols, maxval, and
  102.           format variables.  This function combines pnm_readpnminit(),
  103.           pnm_allocarray() and pnm_readpnmrow().  Unlike the
  104.           equivalent functions in PBM, PGM, and PPM, it returns the
  105.           format so you can tell what type the file is.
  106.  
  107.         WRITING FILES
  108.           void pnm_writepnminit( FILE* fp, int cols, int rows, xelval maxval, int format, int forceplain )
  109.  
  110.           Write the header for a portable anymap file.  Unlike the
  111.           equivalent functions in PBM, PGM, and PPM, you have to
  112.           specify the output type.  The forceplain flag forces a
  113.           plain-format file to be written, as opposed to a raw-format
  114.           one.
  115.  
  116.           void pnm_writepnmrow( FILE* fp, xel* xelrow, int cols, xelval maxval, int format, int forceplain )
  117.  
  118.           Write a row from a portable anymap.
  119.  
  120.           void pnm_writepnm( FILE* fp, xel** xels, int cols, int rows, xelval maxval, int format, int forceplain )
  121.  
  122.           Write the header and all data for a portable anymap.  This
  123.           function combines pnm_writepnminit() and pnm_writepnmrow().
  124.  
  125.         FORMAT PROMOTION
  126.  
  127.  
  128.  
  129.      Page 2                                         (printed 10/19/91)
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136.      libpnm(3)                     AMIGA                     libpnm(3)
  137.  
  138.  
  139.  
  140.           void pnm_promoteformatrow( xel* xelrow, int cols, xelval maxval, int format, xelval newmaxval, int newformat )
  141.  
  142.           Promote a row of xels from one maxval and format to a new
  143.           set.  Used when combining multiple anymaps of different
  144.           types - just take the max of the maxvals and the max of the
  145.           formats, and promote them all to that.
  146.  
  147.           void pnm_promoteformat( xel** xels, int cols, int rows, xelval maxval, int format, xelval newmaxval, int newformat )
  148.  
  149.           Promote an entire anymap.
  150.  
  151.         XEL MANIPULATION
  152.           xel pnm_whitexel( xelval maxval, int format )
  153.           xel pnm_blackxel( xelval maxval, int format )
  154.  
  155.           Return a white or black xel for the given maxval and format.
  156.  
  157.           void pnm_invertxel( xel* x, xelval maxval, int format )
  158.  
  159.           Invert an xel.
  160.  
  161.           xel pnm_backgroundxelrow( xel* xelrow, int cols, xelval maxval, int format )
  162.  
  163.           Figure out an appropriate background xel based on this row.
  164.  
  165.           xel pnm_backgroundxel( xel** xels, int cols, int rows, xelval maxval, int format )
  166.  
  167.           Figure out a background xel based on an entire anymap.  This
  168.           can do a slightly better job than pnm_backgroundxelrow().
  169.  
  170.      SEE ALSO
  171.           pbm(3), pgm(3), ppm(3)
  172.  
  173.      AUTHOR
  174.           Copyright (C) 1989, 1991 by Tony Hansen and Jef Poskanzer.
  175.  
  176.  
  177.  
  178.  
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186.  
  187.  
  188.  
  189.  
  190.  
  191.  
  192.  
  193.  
  194.  
  195.      Page 3                                         (printed 10/19/91)
  196.  
  197.  
  198.  
  199.